#ifndef LOGIN_WIN_H
#define LOGIN_WIN_H

#include "ui_login.h"
#include <QMainWindow>
#include "watcher.h"
#include "g_headers.h"
#include <vector>
#include <string>
#include <QPoint>
using std::string;
using std::vector;

class Sync_win;

class Login_win : public QMainWindow, public Ui::Login_win
{
    Q_OBJECT

public:
    Login_win (Watcher *ptr, bool &p_update, QMainWindow *parent = NULL);
    static void* process_thread(void *p);
    static void* watch_thread(void* p);


signals:
    void start_watch();

private slots:
    void on_login_button_clicked();
    void on_reg_button_clicked();
    void login_succeed();

private:
    void pull_file(ctl_pkg_t &log);
    void win_thread(pthread_t id);
    void mousePressEvent(QMouseEvent *);        //自定义一个鼠标点击事件函数
    void mouseMoveEvent(QMouseEvent * event);   //实现窗口拖拽
    void decode_path(const char* from, char* to);

    Watcher *gsyncer;
    vector<string> all_path;
    string main_dir;
    Sync_win *sync_win;
    bool update;
    int version;
    QPoint dragPosition;                        //定义一个QPoint的成员变量

};

#endif // LOGIN_WIN_H
